package top.iridescent.entity.model.res;

import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;

@Data
public class ChuWoLvModel implements Serializable {

    private String name;
    private int allCounts = 0;
    private int woCounts = 0;
    private Double minChuWoLv=0d;
    private Double chuWoLv = 0D;
    private String description="";
    private Double riJiFen=0d;

    public void add(int total,int wo){
        this.allCounts=this.allCounts+total;
        this.woCounts=this.woCounts+wo;
        BigDecimal allB=new BigDecimal(allCounts);
        BigDecimal woB=new BigDecimal(woCounts);
        BigDecimal gaiLvB=woB.divide(allB,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)).setScale(2);
        chuWoLv=gaiLvB.doubleValue();
    }
}
